{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "5eaccc9b-17f6-4ff9-bc98-d8499eb000c7",
   "metadata": {},
   "source": [
    "# Pandas\n",
    "\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "b0225e17-55d9-4625-b401-d798bfad22c1",
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "import pandas as pd\n",
    "import matplotlib.pyplot as plt\n",
    "%matplotlib inline"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "2357628c-c61b-4b28-b56d-a325c41a5559",
   "metadata": {},
   "source": [
    "### 为什么使用Pandas？\n",
    "\n",
    "Python 内置数据结构类型以及 Numpy 的数组可用于组织管理数据集，其特点如下：\n",
    "\n",
    "| 结构      | 同质 | 可变 | 重复 |  有序  | 映射 |\n",
    "|------------:|-----:|-----:|-----:|-----:|-----:|\n",
    "|列表（list） | 否   |  是 | 是   | 是 |  否  |\n",
    "|元组（tuple）| 否   |  否 | 是   | 是 |  否  |\n",
    "|集合（set）  | 否   |  是 | 否   | 否 |  否  |\n",
    "|字典（dict） | 否   |  是 | 是   | 否 |  是  |\n",
    "|数组（ndarray）| 是   | 是 | 是   | 是 |  否  |"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "e0cb5346-f4c8-43b4-bfc7-8b41e19aa8b6",
   "metadata": {},
   "source": [
    "要分析饭店不同时段用餐人数，如果使用Numpy的话，需要创建两个数组："
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "4be76976-7c85-4b17-97bf-76ea4fa189dd",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([ 60,  70,  65, 100, 230, 150, 100, 300, 250, 150])"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 导入\n",
    "import pandas as pd\n",
    "# 时间4点，5点，... 22点  用标准的list放进去 用np转换\n",
    "times = np.array([6, 7, 8, 11, 12, 13, 18, 19, 20, 21])\n",
    "# 顾客人数\n",
    "customers = np.array([60, 70, 65, 100, 230, 150, 100, 300, 250, 150])\n",
    "customers"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "c51fa976-e049-4bef-806f-0bdd2565a575",
   "metadata": {},
   "source": [
    "要分析饭店不同时段用餐人数，如果使用Pandas的话，需要创建两个序列："
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "id": "8f15c5cb-9e6f-488c-9d28-38c38bdc4429",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0     60\n",
       "1     70\n",
       "2     65\n",
       "3    100\n",
       "4    230\n",
       "5    150\n",
       "6    100\n",
       "7    300\n",
       "8    250\n",
       "9    150\n",
       "dtype: int64"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 导入\n",
    "import pandas as pd\n",
    "# 时间4点，5点，... 22点  用标准的list放进去 用np转换\n",
    "times = pd.Series([6, 7, 8, 11, 12, 13, 18, 19, 20, 21])\n",
    "# 顾客人数\n",
    "customers = pd.Series([60, 70, 65, 100, 230, 150, 100, 300, 250, 150])\n",
    "customers"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "55e9e7ba-91b6-4b3d-89ab-0dda80b0614a",
   "metadata": {},
   "source": [
    "## 画图！"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "a93500fd-aba7-4b77-8b10-bcaf528e117c",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[<matplotlib.lines.Line2D at 0x25c1fe42840>]"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAigAAAGdCAYAAAA44ojeAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjguNCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8fJSN1AAAACXBIWXMAAA9hAAAPYQGoP6dpAABNvElEQVR4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81aX5RWlpKb1792bWrFkNPv7UU08xY8YMZs2axZo1a0hJSWHEiBG+fZ6Czane75EjR1i3bh2PPfYY69at45133mHLli2MGzfOgkr943R/vl7vvvsuq1evblRbbTs73fv97rvvGDRoEOeeey5Llizhq6++4rHHHiM6OjrAlfrH6d7v5MmT+fDDD5kzZw6bN29m8uTJTJo0iX/9618BrtQ/li5dyoQJE1i1ahULFy6kurqakSNHUlpa6rvGab+zGsUQ48EHHzQGDRpkdRkB9cMf/tD4+c9/Xu/ctddea9xyyy0WVdRyAGP+/Pm+r2tra42UlBTjiSee8J0rLy83EhISjJdeesmCCv3r+PfbkC+++MIAjO3btwemqBZ0sve7a9cuo2PHjkZubq7RuXNn45lnngl4bS2hofd7ww03OPJn1zAafr89e/Y0/vCHP9Q7d+GFFxq//e1vA1hZyykoKDAAY+nSpYZhOP931sloBAVYsGAB/fr147rrriMpKYk+ffrwyiuvWF1Wixo0aBCLFy9my5YtAHz11VcsX76cH/zgBxZX1vLy8vLIz89n5MiRvnNut5shQ4awYsUKCysLnKKiIlwul2NHCWtra7n11lt54IEH6Nmzp9XltKja2lref/99unXrxqhRo0hKSqJ///6nvO0V7AYNGsSCBQvYvXs3hmHw6aefsmXLFkaNGmV1aX5RVFQEQGJiIhC6v7MUUIBt27Yxe/ZsunbtykcffcSvfvUr7r77bt58802rS2sxDz74IDfddBPnnnsukZGR9OnTh+zsbG666SarS2tx+fn5ACQnJ9c7n5yc7HvMycrLy3nooYe4+eabHbP52PGefPJJIiIiuPvuu60upcUVFBRQUlLCE088wZVXXsnHH3/MNddcw7XXXsvSpUutLq9FPPfcc5x33nmkp6cTFRXFlVdeyYsvvsigQYOsLq3ZDMPg3nvvZdCgQWRlZQGh+zvL75sFBqPa2lr69evHtGnTAOjTpw+bNm1i9uzZ/PSnP7W4upbxt7/9jTlz5jB37lx69uxJTk4O2dnZpKWlcdttt1ldXkC4XK56XxuGccI5p6mqquLGG2+ktraWF1980epyWsTatWuZOXMm69atc/yfJ+Cb2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uNW6//XYjLS3NiI6ONrp37278+c9/Nmpra60t/Ayd7Ofztdde813jtN9ZjeEyDMNo0QQkIiIi0kSagyIiIiK2o4AiIiIitqOAIiIiIrajgCIiIiK2o4AiIiIitqOAIiIiIrajgCIiIiK2o4AiIiIitqOAIiIiIrajgCIiIiK2o4AiIiIitqOAIiIiIrbz/wHUGXqvV2jAswAAAABJRU5ErkJggg==",
      "text/plain": [
       "<Figure size 640x480 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "# 绘制不同时段顾客人数的变化 \n",
    "plt.plot(times, customers, '+')\n",
    "plt.plot(times, customers)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "d9cf04af-37c4-4a7a-b417-e82862255850",
   "metadata": {},
   "source": [
    "### 核心数据结构\n",
    "\n",
    "- 类型`Series`；\n",
    "- 数据帧`DataFrame`；"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "2a1f4d30-4b17-43cb-a4f1-8750e777759c",
   "metadata": {},
   "source": [
    "**`Series`类型**\n",
    "\n",
    "| 结构      | 同质 | 可变 | 重复 |  有序  | 索引 |\n",
    "|------------:|-----:|-----:|-----:|-----:|-----:|\n",
    "|列表（list） | 否   |  是 | 是   | 是 |  否  |\n",
    "|数组（`ndarray`）| 是   | 是 | 是   | 是 |  否  |\n",
    "|序列（`Series`）| 是   | 是 | 是   | 是 |  是  |\n",
    "\n",
    "\n",
    "\n",
    "**`DataFrame`数据帧**\n",
    "\n",
    "`DataFrame`是一个表格型的数据结构，中文可称为数据帧。把`DataFrame`理解为`Series`在横向上的扩展，包含一组有序的列，每个列都使用同一个索引，即`DataFrame`对象除了行索引外，还有列索引。\n",
    "\n",
    "\n",
    "| 结构      | 同质 | 可变 | 重复 |  有序  | 映射 | 多列 |\n",
    "|------------:|-----:|-----:|-----:|-----:|-----:|-----:|\n",
    "|序列（`Series`）| 是   | 是 | 是   | 是 |  是  | 否  |\n",
    "|数据帧（`DataFrame`）| 是  | 是 | 是   | 是 |  是  |是  |"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "4c0e1dea-d5f9-4a89-9c4c-0ed610fdd142",
   "metadata": {},
   "source": [
    "## `Series`数据类型\n",
    "\n",
    "- 创建对象\n",
    "- 识别对象\n",
    "- 增、删、改、查\n",
    "\n",
    "  可以调用`pd.Series`来创建一个`Series`对象。其语法为：\n",
    "```\n",
    "pandas.Series(data, index, dtype, copy)\n",
    "```\n",
    "其中参数说明为：\n",
    "- `data`，数据，支持类数组、字典、标量对象；\n",
    "- `index`，索引，支持类数组、一维索引对象；\n",
    "- `dtype`，数据类型；\n",
    "- `copy`，布尔值，缺省是False，是否拷贝数据；\n",
    "\n",
    "这里使用前面提过的不同时段顾客人数："
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "id": "ede51802-b89f-419a-b3f6-d31004345f6d",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0     60\n",
       "1     70\n",
       "2     65\n",
       "3    100\n",
       "4    230\n",
       "5    150\n",
       "6    100\n",
       "7    300\n",
       "8    250\n",
       "9    150\n",
       "dtype: int64"
      ]
     },
     "execution_count": 17,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "customers = pd.Series([60, 70, 65, 100, 230, 150, 100, 300, 250, 150])\n",
    "customers"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "cf733444-44a6-422a-b63e-7fa2a80a4dc3",
   "metadata": {},
   "source": [
    "从上面结果可知，`Series`数据结构除了一维数组外，还有对应的索引（或标识）。在创建`Series`对象时不指定索引会自动创建一个整数型索引。可以通过`values`和`index`属性得到数据值和索引："
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "id": "f1702daf-c391-4e91-8390-92562a879427",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "RangeIndex(start=0, stop=10, step=1)"
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "customers.index  #索引"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "9a92acfa-b721-440c-97bc-a7cc8f0e86ec",
   "metadata": {},
   "source": [
    "customers = pd.Series([60, 70, 65, 100, 230, 150, 100, 300, 250, 150], \n",
    "                      index=[6, 7, 8, 11, 12, 13, 18, 19, 20, 21])\n",
    "customers"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "24efbbbd-9284-4a69-8b9e-ae800d2ab242",
   "metadata": {},
   "source": [
    "#### 用字典来创建`Series`对象\n",
    "\n",
    "`Series`对象有一个索引以及数组，索引值与数据值存在一个映射关系。Python中的字典是一个类似键值对数据结构，使用`pd.Series`并传入一个字典对象，也可以创建一个`Series`对象，其索引就是字典中的键（有序排列）"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "id": "416a4124-0fcf-400f-b046-f1a65e0fdec7",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Xuhui      200\n",
       "Pudong     180\n",
       "Jingan     210\n",
       "Sheshan    100\n",
       "dtype: int64"
      ]
     },
     "execution_count": 20,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 饭店-顾客的字典\n",
    "hotel2customer = {'Xuhui': 200, 'Pudong': 180, 'Jingan': 210, 'Sheshan': 100}   #左边是索引 右边是索引的值\n",
    "customers = pd.Series(hotel2customer)\n",
    "customers"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "04490d1b-ba84-4924-a996-aac3584ff1c0",
   "metadata": {},
   "source": [
    "### 访问`Series`对象的元素\n",
    "\n",
    "`Series`对象是有序、由映射的，还可以用编号来访问："
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "id": "de64e56a-24fb-4a40-80df-07b8b332d403",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "200"
      ]
     },
     "execution_count": 21,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "customers['Xuhui']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "id": "f2306779-cd98-4c58-801b-fa4d44301d18",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "200"
      ]
     },
     "execution_count": 23,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "customers.iloc[0]      #iloc（i：index loc：locate） 当不使用索引 可以用iloc按顺序取出想要的值"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "95e61253-6ae2-48dc-9cac-85b4989dbb08",
   "metadata": {},
   "source": [
    "## `DataFrame`数据类型\n",
    "\n",
    "`DataFrame`是一个表格型的数据结构。可以把`DataFrame`理解为`Series`在横向上的扩展，它包含一组有序的列，每个列都使用同一个索引。\n",
    "\n",
    "`DataFrame`对象除了类似于`Series`的行索引外，也有列索引。\n",
    "\n",
    "可以调用`pd.DataFrame()`来创建一个`DataFrame`对象。其语法为：\n",
    "```\n",
    "pandas.DataFrame(data, index, columns, dtype, copy)\n",
    "```\n",
    "其中参数说明为：\n",
    "- `data`，数据支持多种形式，包括数组、Series、列表、字典、标量或`DataFrame`对象；\n",
    "- `index`，行索引，与`Series`的索引类似；\n",
    "- `columns`，列索引；\n",
    "- `dtype`，每列的数据类型；\n",
    "- `copy`，布尔值，默认是False，是否拷贝数据；"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 46,
   "id": "4023d06f-02b2-43cd-9a88-031668583b25",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>customers</th>\n",
       "      <th>costs</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>60</td>\n",
       "      <td>6</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>70</td>\n",
       "      <td>7</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>65</td>\n",
       "      <td>8</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>100</td>\n",
       "      <td>24</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>230</td>\n",
       "      <td>23</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>150</td>\n",
       "      <td>26</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>18</th>\n",
       "      <td>100</td>\n",
       "      <td>45</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>19</th>\n",
       "      <td>300</td>\n",
       "      <td>55</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>20</th>\n",
       "      <td>250</td>\n",
       "      <td>45</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>21</th>\n",
       "      <td>150</td>\n",
       "      <td>40</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "    customers  costs\n",
       "6          60      6\n",
       "7          70      7\n",
       "8          65      8\n",
       "11        100     24\n",
       "12        230     23\n",
       "13        150     26\n",
       "18        100     45\n",
       "19        300     55\n",
       "20        250     45\n",
       "21        150     40"
      ]
     },
     "execution_count": 46,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 时段4点，5点，... 22点\n",
    "times = np.array([6, 7, 8, 11, 12, 13, 18, 19, 20, 21])\n",
    "# 顾客人数\n",
    "customers = np.array([60, 70, 65, 100, 230, 150, 100, 300, 250, 150])\n",
    "# 平均消费\n",
    "costs = np.array([6, 7, 8, 24, 23, 26, 45, 55, 45, 40])\n",
    "\n",
    "#通过传入等长的列表或数组组成的字典来创建DataFrame对象：\n",
    "data = {'customers': customers, 'costs': costs}\n",
    "df = pd.DataFrame(data, index=times)\n",
    "df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "id": "a834e2bd-4484-4c7b-9d2f-ad0147d4e3b6",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "23"
      ]
     },
     "execution_count": 28,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df['costs'][12]   #找12点的时候 花费多少  表示方法如左"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "8521130b-7a93-4db5-a3e3-3d9f80d9b1d1",
   "metadata": {},
   "source": [
    "### 课堂训练1：生成40个同学的语文成绩，平均分80分，标准差20分，请用随机数生成40个分数，要求为整数\n",
    "\n",
    "numpy.random.normal的应用"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "086f0cd9-ed94-405f-91d2-4999bcc254eb",
   "metadata": {},
   "outputs": [],
   "source": [
    "# numpy.random.normal是 NumPy 库中用于生成正态分布（高斯分布）随机数的函数。以下是它的一些常用参数和用法：\n",
    "\n",
    "函数原型\n",
    "python\n",
    "numpy.random.normal(loc=0.0, scale=1.0, size=None)\n",
    "参数说明\n",
    "loc：分布的均值（平均值），默认为0.0。\n",
    "scale：分布的标准差，非负数，如果为0则返回一个常数数组，默认为1.0。\n",
    "size：输出数组的形状。如果为None（默认），则返回单个随机数。如果为整数，则返回长度为该整数的一维数组。如果为元组，则返回相应形状的数组。\n",
    "返回值\n",
    "返回一个或多个服从指定均值和标准差的正态分布的随机数。\n",
    "\n",
    "示例用法\n",
    "生成单个随机数：\n",
    "python\n",
    "import numpy as np\n",
    "\n",
    "# 生成一个均值为0，标准差为1的正态分布随机数\n",
    "single_value = np.random.normal()\n",
    "print(single_value)\n",
    "生成固定数量的随机数：\n",
    "python\n",
    "# 生成10个均值为5，标准差为2的正态分布随机数\n",
    "values = np.random.normal(loc=5, scale=2, size=10)\n",
    "print(values)\n",
    "生成多维数组：\n",
    "python\n",
    "# 生成一个3x5的数组，均值为3，标准差为1\n",
    "values = np.random.normal(loc=3, scale=1, size=(3, 5))\n",
    "print(values)\n",
    "生成具有特定形状的数组：\n",
    "python\n",
    "# 生成一个具有特定形状的数组，均值为10，标准差为0.5\n",
    "values = np.random.normal(loc=10, scale=0.5, size=(4, 3, 2))\n",
    "print(values)\n",
    "生成随机数并进行四舍五入：\n",
    "python\n",
    "# 生成100个均值为0，标准差为1的正态分布随机数，并四舍五入到最近的整数\n",
    "values = np.round(np.random.normal(size=100))\n",
    "print(values)\n",
    "生成随机数并确保非负：\n",
    "python\n",
    "# 生成100个均值为0，标准差为1的正态分布随机数，并确保所有值非负\n",
    "values = np.abs(np.random.normal(size=100))\n",
    "print(values)\n",
    "使用随机种子：\n",
    "python\n",
    "# 设置随机种子以确保结果可复现\n",
    "np.random.seed(0)\n",
    "\n",
    "# 生成随机数\n",
    "values = np.random.normal(size=10)\n",
    "print(values)\n",
    "numpy.random.normal 是一个非常灵活的函数，可以用于各种需要生成正态分布随机数的场景。通过调整 loc、scale 和 size 参数，你可以控制生成的随机数的分布特性和形状。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 35,
   "id": "9d200faa-89d2-4342-9f3c-c903e6ab9d65",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([ 87,  58,  85, 106,  66,  77,  71, 116,  93,  88,  64,  90,  66,\n",
       "        80,  67,  93,  91,  75,  87,  58,  50,  88,  83,  92, 127,  98,\n",
       "        61, 102,  53,  70,  78, 114,  65,  63,  78,  66, 102,  58,  57,\n",
       "        71])"
      ]
     },
     "execution_count": 35,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "chinese = np.random.normal(80,20,40).astype(np.int32)\n",
    "chinese"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 69,
   "id": "1c45d94e-0f09-45a2-a47e-7b68d5d80de5",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[115  88 100 125 117  60  99  77  78  88  83 109  95  82  89  87 110  76\n",
      "  86  63  29  93  97  65 125  51  81  76 111 109  83  88  62  40  73  83\n",
      " 105 104  72  74]\n"
     ]
    }
   ],
   "source": [
    "#gpt\n",
    "\n",
    "import numpy as np\n",
    "import pandas as pd\n",
    "\n",
    "# 设置随机种子以确保结果可复现\n",
    "np.random.seed(0)\n",
    "\n",
    "# 生成40个正态分布的随机数\n",
    "scores = np.random.normal(loc=80, scale=20, size=40)\n",
    "\n",
    "# 四舍五入到最近的整数\n",
    "scores_rounded = np.round(scores).astype(int)\n",
    "\n",
    "print(scores_rounded)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 38,
   "id": "8791cbc2-59b0-496e-aaa5-11e918916f77",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "    语文成绩\n",
      "0    115\n",
      "1     88\n",
      "2    100\n",
      "3    125\n",
      "4    117\n",
      "5     60\n",
      "6     99\n",
      "7     77\n",
      "8     78\n",
      "9     88\n",
      "10    83\n",
      "11   109\n",
      "12    95\n",
      "13    82\n",
      "14    89\n",
      "15    87\n",
      "16   110\n",
      "17    76\n",
      "18    86\n",
      "19    63\n",
      "20    29\n",
      "21    93\n",
      "22    97\n",
      "23    65\n",
      "24   125\n",
      "25    51\n",
      "26    81\n",
      "27    76\n",
      "28   111\n",
      "29   109\n",
      "30    83\n",
      "31    88\n",
      "32    62\n",
      "33    40\n",
      "34    73\n",
      "35    83\n",
      "36   105\n",
      "37   104\n",
      "38    72\n",
      "39    74\n"
     ]
    }
   ],
   "source": [
    "# 创建一个DataFrame来存储分数\n",
    "df = pd.DataFrame(scores_rounded, columns=['语文成绩'])\n",
    "\n",
    "# 显示DataFrame\n",
    "print(df)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "1d289762-e081-4652-861a-b0480f65baa8",
   "metadata": {},
   "source": [
    "##### 课堂训练2：生成40个同学的成绩，语文平均分80分，标准差20分，请用随机数生成40个分数，要求为整数\n",
    "#####  数学     80         30\n",
    "#####  英语     70         20\n",
    "#####  物理     80         10\n",
    "numpy.random.normal的应用"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 50,
   "id": "a03d49d4-c703-4374-83f4-708a97b63ad2",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>语文成绩</th>\n",
       "      <th>数学成绩</th>\n",
       "      <th>英语成绩</th>\n",
       "      <th>物理成绩</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>72</td>\n",
       "      <td>103</td>\n",
       "      <td>65</td>\n",
       "      <td>120</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>56</td>\n",
       "      <td>110</td>\n",
       "      <td>51</td>\n",
       "      <td>79</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>78</td>\n",
       "      <td>52</td>\n",
       "      <td>36</td>\n",
       "      <td>83</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>83</td>\n",
       "      <td>67</td>\n",
       "      <td>52</td>\n",
       "      <td>44</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>97</td>\n",
       "      <td>105</td>\n",
       "      <td>74</td>\n",
       "      <td>65</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>77</td>\n",
       "      <td>0</td>\n",
       "      <td>52</td>\n",
       "      <td>83</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>89</td>\n",
       "      <td>125</td>\n",
       "      <td>88</td>\n",
       "      <td>87</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>60</td>\n",
       "      <td>96</td>\n",
       "      <td>98</td>\n",
       "      <td>92</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>64</td>\n",
       "      <td>78</td>\n",
       "      <td>22</td>\n",
       "      <td>80</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>77</td>\n",
       "      <td>86</td>\n",
       "      <td>87</td>\n",
       "      <td>90</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>58</td>\n",
       "      <td>49</td>\n",
       "      <td>25</td>\n",
       "      <td>89</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>96</td>\n",
       "      <td>69</td>\n",
       "      <td>78</td>\n",
       "      <td>43</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>89</td>\n",
       "      <td>113</td>\n",
       "      <td>94</td>\n",
       "      <td>80</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>85</td>\n",
       "      <td>118</td>\n",
       "      <td>71</td>\n",
       "      <td>95</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14</th>\n",
       "      <td>86</td>\n",
       "      <td>160</td>\n",
       "      <td>44</td>\n",
       "      <td>91</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>15</th>\n",
       "      <td>120</td>\n",
       "      <td>77</td>\n",
       "      <td>58</td>\n",
       "      <td>72</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>16</th>\n",
       "      <td>70</td>\n",
       "      <td>60</td>\n",
       "      <td>64</td>\n",
       "      <td>63</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>17</th>\n",
       "      <td>35</td>\n",
       "      <td>64</td>\n",
       "      <td>66</td>\n",
       "      <td>57</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>18</th>\n",
       "      <td>83</td>\n",
       "      <td>49</td>\n",
       "      <td>65</td>\n",
       "      <td>77</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>19</th>\n",
       "      <td>78</td>\n",
       "      <td>77</td>\n",
       "      <td>67</td>\n",
       "      <td>102</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>20</th>\n",
       "      <td>69</td>\n",
       "      <td>91</td>\n",
       "      <td>74</td>\n",
       "      <td>40</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>21</th>\n",
       "      <td>60</td>\n",
       "      <td>78</td>\n",
       "      <td>45</td>\n",
       "      <td>66</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>22</th>\n",
       "      <td>71</td>\n",
       "      <td>112</td>\n",
       "      <td>65</td>\n",
       "      <td>57</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>23</th>\n",
       "      <td>83</td>\n",
       "      <td>72</td>\n",
       "      <td>100</td>\n",
       "      <td>95</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>24</th>\n",
       "      <td>69</td>\n",
       "      <td>69</td>\n",
       "      <td>62</td>\n",
       "      <td>68</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>25</th>\n",
       "      <td>128</td>\n",
       "      <td>62</td>\n",
       "      <td>61</td>\n",
       "      <td>70</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>26</th>\n",
       "      <td>60</td>\n",
       "      <td>31</td>\n",
       "      <td>91</td>\n",
       "      <td>75</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>27</th>\n",
       "      <td>64</td>\n",
       "      <td>32</td>\n",
       "      <td>18</td>\n",
       "      <td>88</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>28</th>\n",
       "      <td>34</td>\n",
       "      <td>44</td>\n",
       "      <td>93</td>\n",
       "      <td>72</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>29</th>\n",
       "      <td>85</td>\n",
       "      <td>119</td>\n",
       "      <td>57</td>\n",
       "      <td>19</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>30</th>\n",
       "      <td>39</td>\n",
       "      <td>106</td>\n",
       "      <td>73</td>\n",
       "      <td>90</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>31</th>\n",
       "      <td>69</td>\n",
       "      <td>121</td>\n",
       "      <td>71</td>\n",
       "      <td>88</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32</th>\n",
       "      <td>74</td>\n",
       "      <td>40</td>\n",
       "      <td>88</td>\n",
       "      <td>75</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>33</th>\n",
       "      <td>65</td>\n",
       "      <td>20</td>\n",
       "      <td>64</td>\n",
       "      <td>58</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>34</th>\n",
       "      <td>114</td>\n",
       "      <td>60</td>\n",
       "      <td>56</td>\n",
       "      <td>87</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>35</th>\n",
       "      <td>99</td>\n",
       "      <td>85</td>\n",
       "      <td>95</td>\n",
       "      <td>87</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>36</th>\n",
       "      <td>106</td>\n",
       "      <td>94</td>\n",
       "      <td>22</td>\n",
       "      <td>70</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>37</th>\n",
       "      <td>62</td>\n",
       "      <td>111</td>\n",
       "      <td>70</td>\n",
       "      <td>75</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>38</th>\n",
       "      <td>102</td>\n",
       "      <td>88</td>\n",
       "      <td>43</td>\n",
       "      <td>61</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>39</th>\n",
       "      <td>89</td>\n",
       "      <td>132</td>\n",
       "      <td>54</td>\n",
       "      <td>76</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "    语文成绩  数学成绩  英语成绩  物理成绩\n",
       "0     72   103    65   120\n",
       "1     56   110    51    79\n",
       "2     78    52    36    83\n",
       "3     83    67    52    44\n",
       "4     97   105    74    65\n",
       "5     77     0    52    83\n",
       "6     89   125    88    87\n",
       "7     60    96    98    92\n",
       "8     64    78    22    80\n",
       "9     77    86    87    90\n",
       "10    58    49    25    89\n",
       "11    96    69    78    43\n",
       "12    89   113    94    80\n",
       "13    85   118    71    95\n",
       "14    86   160    44    91\n",
       "15   120    77    58    72\n",
       "16    70    60    64    63\n",
       "17    35    64    66    57\n",
       "18    83    49    65    77\n",
       "19    78    77    67   102\n",
       "20    69    91    74    40\n",
       "21    60    78    45    66\n",
       "22    71   112    65    57\n",
       "23    83    72   100    95\n",
       "24    69    69    62    68\n",
       "25   128    62    61    70\n",
       "26    60    31    91    75\n",
       "27    64    32    18    88\n",
       "28    34    44    93    72\n",
       "29    85   119    57    19\n",
       "30    39   106    73    90\n",
       "31    69   121    71    88\n",
       "32    74    40    88    75\n",
       "33    65    20    64    58\n",
       "34   114    60    56    87\n",
       "35    99    85    95    87\n",
       "36   106    94    22    70\n",
       "37    62   111    70    75\n",
       "38   102    88    43    61\n",
       "39    89   132    54    76"
      ]
     },
     "execution_count": 50,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "chinese = np.random.normal(80,20,40).astype(np.int32)\n",
    "maths = np.random.normal(80,30,40).astype(np.int32)\n",
    "English = np.random.normal(70,20,40).astype(np.int32)\n",
    "physics = np.random.normal(80,20,40).astype(np.int32)\n",
    "\n",
    "# 创建一个DataFrame来存储分数\n",
    "data = {'语文成绩': chinese, '数学成绩': maths,'英语成绩':English, '物理成绩': physics}\n",
    "df = pd.DataFrame({'语文成绩': chinese, '数学成绩': maths,'英语成绩':English, '物理成绩': physics})\n",
    "df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 51,
   "id": "a7ffad88-820c-4e28-9aad-2b035f6c7dd1",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>语文成绩</th>\n",
       "      <th>数学成绩</th>\n",
       "      <th>物理成绩</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>115</td>\n",
       "      <td>39</td>\n",
       "      <td>68</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>88</td>\n",
       "      <td>27</td>\n",
       "      <td>89</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>100</td>\n",
       "      <td>19</td>\n",
       "      <td>85</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>125</td>\n",
       "      <td>129</td>\n",
       "      <td>65</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>117</td>\n",
       "      <td>55</td>\n",
       "      <td>95</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>60</td>\n",
       "      <td>57</td>\n",
       "      <td>99</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>99</td>\n",
       "      <td>32</td>\n",
       "      <td>92</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>77</td>\n",
       "      <td>93</td>\n",
       "      <td>78</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>78</td>\n",
       "      <td>22</td>\n",
       "      <td>69</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>88</td>\n",
       "      <td>64</td>\n",
       "      <td>91</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>83</td>\n",
       "      <td>43</td>\n",
       "      <td>76</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>109</td>\n",
       "      <td>82</td>\n",
       "      <td>92</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>95</td>\n",
       "      <td>55</td>\n",
       "      <td>82</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>82</td>\n",
       "      <td>35</td>\n",
       "      <td>90</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14</th>\n",
       "      <td>89</td>\n",
       "      <td>69</td>\n",
       "      <td>84</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>15</th>\n",
       "      <td>87</td>\n",
       "      <td>83</td>\n",
       "      <td>87</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>16</th>\n",
       "      <td>110</td>\n",
       "      <td>72</td>\n",
       "      <td>80</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>17</th>\n",
       "      <td>76</td>\n",
       "      <td>79</td>\n",
       "      <td>98</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>18</th>\n",
       "      <td>86</td>\n",
       "      <td>51</td>\n",
       "      <td>81</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>19</th>\n",
       "      <td>63</td>\n",
       "      <td>59</td>\n",
       "      <td>84</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>20</th>\n",
       "      <td>29</td>\n",
       "      <td>50</td>\n",
       "      <td>99</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>21</th>\n",
       "      <td>93</td>\n",
       "      <td>59</td>\n",
       "      <td>67</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>22</th>\n",
       "      <td>97</td>\n",
       "      <td>46</td>\n",
       "      <td>67</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>23</th>\n",
       "      <td>65</td>\n",
       "      <td>18</td>\n",
       "      <td>90</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>24</th>\n",
       "      <td>125</td>\n",
       "      <td>75</td>\n",
       "      <td>68</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>25</th>\n",
       "      <td>51</td>\n",
       "      <td>58</td>\n",
       "      <td>99</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>26</th>\n",
       "      <td>81</td>\n",
       "      <td>21</td>\n",
       "      <td>76</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>27</th>\n",
       "      <td>76</td>\n",
       "      <td>84</td>\n",
       "      <td>73</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>28</th>\n",
       "      <td>111</td>\n",
       "      <td>43</td>\n",
       "      <td>99</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>29</th>\n",
       "      <td>109</td>\n",
       "      <td>72</td>\n",
       "      <td>95</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>30</th>\n",
       "      <td>83</td>\n",
       "      <td>92</td>\n",
       "      <td>99</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>31</th>\n",
       "      <td>88</td>\n",
       "      <td>74</td>\n",
       "      <td>89</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32</th>\n",
       "      <td>62</td>\n",
       "      <td>104</td>\n",
       "      <td>71</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>33</th>\n",
       "      <td>40</td>\n",
       "      <td>33</td>\n",
       "      <td>99</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>34</th>\n",
       "      <td>73</td>\n",
       "      <td>82</td>\n",
       "      <td>77</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>35</th>\n",
       "      <td>83</td>\n",
       "      <td>49</td>\n",
       "      <td>88</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>36</th>\n",
       "      <td>105</td>\n",
       "      <td>44</td>\n",
       "      <td>89</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>37</th>\n",
       "      <td>104</td>\n",
       "      <td>53</td>\n",
       "      <td>78</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>38</th>\n",
       "      <td>72</td>\n",
       "      <td>61</td>\n",
       "      <td>86</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>39</th>\n",
       "      <td>74</td>\n",
       "      <td>72</td>\n",
       "      <td>89</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "    语文成绩  数学成绩  物理成绩\n",
       "0    115    39    68\n",
       "1     88    27    89\n",
       "2    100    19    85\n",
       "3    125   129    65\n",
       "4    117    55    95\n",
       "5     60    57    99\n",
       "6     99    32    92\n",
       "7     77    93    78\n",
       "8     78    22    69\n",
       "9     88    64    91\n",
       "10    83    43    76\n",
       "11   109    82    92\n",
       "12    95    55    82\n",
       "13    82    35    90\n",
       "14    89    69    84\n",
       "15    87    83    87\n",
       "16   110    72    80\n",
       "17    76    79    98\n",
       "18    86    51    81\n",
       "19    63    59    84\n",
       "20    29    50    99\n",
       "21    93    59    67\n",
       "22    97    46    67\n",
       "23    65    18    90\n",
       "24   125    75    68\n",
       "25    51    58    99\n",
       "26    81    21    76\n",
       "27    76    84    73\n",
       "28   111    43    99\n",
       "29   109    72    95\n",
       "30    83    92    99\n",
       "31    88    74    89\n",
       "32    62   104    71\n",
       "33    40    33    99\n",
       "34    73    82    77\n",
       "35    83    49    88\n",
       "36   105    44    89\n",
       "37   104    53    78\n",
       "38    72    61    86\n",
       "39    74    72    89"
      ]
     },
     "execution_count": 51,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#gpt\n",
    "\n",
    "import numpy as np\n",
    "import pandas as pd\n",
    "\n",
    "# 设置随机种子以确保结果可复现\n",
    "np.random.seed(0)\n",
    "\n",
    "# 生成语文成绩\n",
    "chinese_scores = np.round(np.random.normal(loc=80, scale=20, size=40)).astype(int)\n",
    "\n",
    "# 生成数学成绩\n",
    "math_scores = np.round(np.random.normal(loc=70, scale=30, size=40)).astype(int)\n",
    "\n",
    "# 生成物理成绩\n",
    "physics_scores = np.round(np.random.normal(loc=80, scale=10, size=40)).astype(int)\n",
    "\n",
    "# 创建一个DataFrame来存储成绩\n",
    "df = pd.DataFrame({\n",
    "    '语文成绩': chinese_scores,\n",
    "    '数学成绩': math_scores,\n",
    "    '物理成绩': physics_scores\n",
    "})\n",
    "\n",
    "# 显示DataFrame\n",
    "df"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "889221b1-7316-4880-9684-0d858ab4ba0a",
   "metadata": {},
   "source": [
    "##### 课堂训练3：生成40个同学的成绩，语文平均分80分，标准差20分，请用随机数生成40个分数，要求为整数\n",
    "#####  数学     80         30\n",
    "#####  英语     70         20\n",
    "#####  物理     80         10\n",
    "##### 生成学号32219100001-32219100040"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 59,
   "id": "56ee5dba-0518-4199-bfaa-b8e10756fca5",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>语文成绩</th>\n",
       "      <th>数学成绩</th>\n",
       "      <th>英语成绩</th>\n",
       "      <th>物理成绩</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>32219100001</th>\n",
       "      <td>71</td>\n",
       "      <td>101</td>\n",
       "      <td>60</td>\n",
       "      <td>62</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100002</th>\n",
       "      <td>73</td>\n",
       "      <td>113</td>\n",
       "      <td>98</td>\n",
       "      <td>40</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100003</th>\n",
       "      <td>91</td>\n",
       "      <td>49</td>\n",
       "      <td>88</td>\n",
       "      <td>111</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100004</th>\n",
       "      <td>60</td>\n",
       "      <td>61</td>\n",
       "      <td>83</td>\n",
       "      <td>92</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100005</th>\n",
       "      <td>71</td>\n",
       "      <td>107</td>\n",
       "      <td>86</td>\n",
       "      <td>57</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100006</th>\n",
       "      <td>63</td>\n",
       "      <td>93</td>\n",
       "      <td>76</td>\n",
       "      <td>55</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100007</th>\n",
       "      <td>59</td>\n",
       "      <td>107</td>\n",
       "      <td>102</td>\n",
       "      <td>97</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100008</th>\n",
       "      <td>62</td>\n",
       "      <td>76</td>\n",
       "      <td>77</td>\n",
       "      <td>62</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100009</th>\n",
       "      <td>93</td>\n",
       "      <td>71</td>\n",
       "      <td>74</td>\n",
       "      <td>105</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100010</th>\n",
       "      <td>81</td>\n",
       "      <td>20</td>\n",
       "      <td>73</td>\n",
       "      <td>92</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100011</th>\n",
       "      <td>62</td>\n",
       "      <td>45</td>\n",
       "      <td>73</td>\n",
       "      <td>90</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100012</th>\n",
       "      <td>75</td>\n",
       "      <td>81</td>\n",
       "      <td>46</td>\n",
       "      <td>88</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100013</th>\n",
       "      <td>47</td>\n",
       "      <td>104</td>\n",
       "      <td>85</td>\n",
       "      <td>83</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100014</th>\n",
       "      <td>65</td>\n",
       "      <td>95</td>\n",
       "      <td>67</td>\n",
       "      <td>97</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100015</th>\n",
       "      <td>122</td>\n",
       "      <td>76</td>\n",
       "      <td>106</td>\n",
       "      <td>70</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100016</th>\n",
       "      <td>78</td>\n",
       "      <td>71</td>\n",
       "      <td>68</td>\n",
       "      <td>81</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100017</th>\n",
       "      <td>94</td>\n",
       "      <td>86</td>\n",
       "      <td>78</td>\n",
       "      <td>95</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100018</th>\n",
       "      <td>78</td>\n",
       "      <td>82</td>\n",
       "      <td>74</td>\n",
       "      <td>91</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100019</th>\n",
       "      <td>86</td>\n",
       "      <td>122</td>\n",
       "      <td>57</td>\n",
       "      <td>56</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100020</th>\n",
       "      <td>93</td>\n",
       "      <td>84</td>\n",
       "      <td>89</td>\n",
       "      <td>69</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100021</th>\n",
       "      <td>57</td>\n",
       "      <td>35</td>\n",
       "      <td>108</td>\n",
       "      <td>85</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100022</th>\n",
       "      <td>79</td>\n",
       "      <td>41</td>\n",
       "      <td>69</td>\n",
       "      <td>71</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100023</th>\n",
       "      <td>111</td>\n",
       "      <td>125</td>\n",
       "      <td>63</td>\n",
       "      <td>115</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100024</th>\n",
       "      <td>64</td>\n",
       "      <td>44</td>\n",
       "      <td>62</td>\n",
       "      <td>72</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100025</th>\n",
       "      <td>68</td>\n",
       "      <td>102</td>\n",
       "      <td>32</td>\n",
       "      <td>76</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100026</th>\n",
       "      <td>73</td>\n",
       "      <td>71</td>\n",
       "      <td>66</td>\n",
       "      <td>95</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100027</th>\n",
       "      <td>85</td>\n",
       "      <td>74</td>\n",
       "      <td>75</td>\n",
       "      <td>86</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100028</th>\n",
       "      <td>90</td>\n",
       "      <td>75</td>\n",
       "      <td>91</td>\n",
       "      <td>77</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100029</th>\n",
       "      <td>105</td>\n",
       "      <td>116</td>\n",
       "      <td>89</td>\n",
       "      <td>64</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100030</th>\n",
       "      <td>89</td>\n",
       "      <td>74</td>\n",
       "      <td>61</td>\n",
       "      <td>86</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100031</th>\n",
       "      <td>78</td>\n",
       "      <td>79</td>\n",
       "      <td>64</td>\n",
       "      <td>100</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100032</th>\n",
       "      <td>105</td>\n",
       "      <td>34</td>\n",
       "      <td>92</td>\n",
       "      <td>89</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100033</th>\n",
       "      <td>94</td>\n",
       "      <td>86</td>\n",
       "      <td>66</td>\n",
       "      <td>64</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100034</th>\n",
       "      <td>50</td>\n",
       "      <td>95</td>\n",
       "      <td>59</td>\n",
       "      <td>114</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100035</th>\n",
       "      <td>130</td>\n",
       "      <td>87</td>\n",
       "      <td>97</td>\n",
       "      <td>51</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100036</th>\n",
       "      <td>115</td>\n",
       "      <td>121</td>\n",
       "      <td>90</td>\n",
       "      <td>48</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100037</th>\n",
       "      <td>76</td>\n",
       "      <td>81</td>\n",
       "      <td>70</td>\n",
       "      <td>99</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100038</th>\n",
       "      <td>87</td>\n",
       "      <td>88</td>\n",
       "      <td>58</td>\n",
       "      <td>84</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100039</th>\n",
       "      <td>106</td>\n",
       "      <td>129</td>\n",
       "      <td>29</td>\n",
       "      <td>69</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100040</th>\n",
       "      <td>76</td>\n",
       "      <td>33</td>\n",
       "      <td>81</td>\n",
       "      <td>58</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "             语文成绩  数学成绩  英语成绩  物理成绩\n",
       "32219100001    71   101    60    62\n",
       "32219100002    73   113    98    40\n",
       "32219100003    91    49    88   111\n",
       "32219100004    60    61    83    92\n",
       "32219100005    71   107    86    57\n",
       "32219100006    63    93    76    55\n",
       "32219100007    59   107   102    97\n",
       "32219100008    62    76    77    62\n",
       "32219100009    93    71    74   105\n",
       "32219100010    81    20    73    92\n",
       "32219100011    62    45    73    90\n",
       "32219100012    75    81    46    88\n",
       "32219100013    47   104    85    83\n",
       "32219100014    65    95    67    97\n",
       "32219100015   122    76   106    70\n",
       "32219100016    78    71    68    81\n",
       "32219100017    94    86    78    95\n",
       "32219100018    78    82    74    91\n",
       "32219100019    86   122    57    56\n",
       "32219100020    93    84    89    69\n",
       "32219100021    57    35   108    85\n",
       "32219100022    79    41    69    71\n",
       "32219100023   111   125    63   115\n",
       "32219100024    64    44    62    72\n",
       "32219100025    68   102    32    76\n",
       "32219100026    73    71    66    95\n",
       "32219100027    85    74    75    86\n",
       "32219100028    90    75    91    77\n",
       "32219100029   105   116    89    64\n",
       "32219100030    89    74    61    86\n",
       "32219100031    78    79    64   100\n",
       "32219100032   105    34    92    89\n",
       "32219100033    94    86    66    64\n",
       "32219100034    50    95    59   114\n",
       "32219100035   130    87    97    51\n",
       "32219100036   115   121    90    48\n",
       "32219100037    76    81    70    99\n",
       "32219100038    87    88    58    84\n",
       "32219100039   106   129    29    69\n",
       "32219100040    76    33    81    58"
      ]
     },
     "execution_count": 59,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "student_ids = np.arange(32219100001, 32219100041)\n",
    "chinese = np.random.normal(80,20,40).astype(np.int32)\n",
    "maths = np.random.normal(80,30,40).astype(np.int32)\n",
    "English = np.random.normal(70,20,40).astype(np.int32)\n",
    "physics = np.random.normal(80,20,40).astype(np.int32)\n",
    "\n",
    "\n",
    "# 创建一个DataFrame来存储分数\n",
    "df = pd.DataFrame({'语文成绩': chinese, '数学成绩': maths,'英语成绩':English, '物理成绩': physics},index = student_ids)\n",
    "df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 65,
   "id": "e9146971-7610-4931-b008-3b8582f0c08f",
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Chinese</th>\n",
       "      <th>Math</th>\n",
       "      <th>English</th>\n",
       "      <th>Physics</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>32219100001</th>\n",
       "      <td>70</td>\n",
       "      <td>64</td>\n",
       "      <td>79</td>\n",
       "      <td>93</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100002</th>\n",
       "      <td>97</td>\n",
       "      <td>30</td>\n",
       "      <td>55</td>\n",
       "      <td>76</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100003</th>\n",
       "      <td>52</td>\n",
       "      <td>86</td>\n",
       "      <td>45</td>\n",
       "      <td>78</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100004</th>\n",
       "      <td>118</td>\n",
       "      <td>79</td>\n",
       "      <td>78</td>\n",
       "      <td>97</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100005</th>\n",
       "      <td>70</td>\n",
       "      <td>76</td>\n",
       "      <td>83</td>\n",
       "      <td>80</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100006</th>\n",
       "      <td>69</td>\n",
       "      <td>81</td>\n",
       "      <td>70</td>\n",
       "      <td>102</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100007</th>\n",
       "      <td>100</td>\n",
       "      <td>-29</td>\n",
       "      <td>96</td>\n",
       "      <td>78</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100008</th>\n",
       "      <td>94</td>\n",
       "      <td>86</td>\n",
       "      <td>88</td>\n",
       "      <td>93</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100009</th>\n",
       "      <td>129</td>\n",
       "      <td>114</td>\n",
       "      <td>123</td>\n",
       "      <td>63</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100010</th>\n",
       "      <td>75</td>\n",
       "      <td>73</td>\n",
       "      <td>65</td>\n",
       "      <td>81</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100011</th>\n",
       "      <td>77</td>\n",
       "      <td>65</td>\n",
       "      <td>50</td>\n",
       "      <td>64</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100012</th>\n",
       "      <td>50</td>\n",
       "      <td>80</td>\n",
       "      <td>55</td>\n",
       "      <td>88</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100013</th>\n",
       "      <td>73</td>\n",
       "      <td>70</td>\n",
       "      <td>58</td>\n",
       "      <td>67</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100014</th>\n",
       "      <td>65</td>\n",
       "      <td>79</td>\n",
       "      <td>79</td>\n",
       "      <td>82</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100015</th>\n",
       "      <td>71</td>\n",
       "      <td>60</td>\n",
       "      <td>26</td>\n",
       "      <td>77</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100016</th>\n",
       "      <td>45</td>\n",
       "      <td>36</td>\n",
       "      <td>96</td>\n",
       "      <td>68</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100017</th>\n",
       "      <td>113</td>\n",
       "      <td>29</td>\n",
       "      <td>65</td>\n",
       "      <td>63</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100018</th>\n",
       "      <td>51</td>\n",
       "      <td>30</td>\n",
       "      <td>65</td>\n",
       "      <td>74</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100019</th>\n",
       "      <td>23</td>\n",
       "      <td>18</td>\n",
       "      <td>48</td>\n",
       "      <td>97</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100020</th>\n",
       "      <td>56</td>\n",
       "      <td>27</td>\n",
       "      <td>67</td>\n",
       "      <td>77</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100021</th>\n",
       "      <td>67</td>\n",
       "      <td>112</td>\n",
       "      <td>70</td>\n",
       "      <td>89</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100022</th>\n",
       "      <td>57</td>\n",
       "      <td>82</td>\n",
       "      <td>67</td>\n",
       "      <td>79</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100023</th>\n",
       "      <td>101</td>\n",
       "      <td>41</td>\n",
       "      <td>76</td>\n",
       "      <td>88</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100024</th>\n",
       "      <td>77</td>\n",
       "      <td>48</td>\n",
       "      <td>58</td>\n",
       "      <td>61</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100025</th>\n",
       "      <td>80</td>\n",
       "      <td>63</td>\n",
       "      <td>52</td>\n",
       "      <td>75</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100026</th>\n",
       "      <td>92</td>\n",
       "      <td>40</td>\n",
       "      <td>80</td>\n",
       "      <td>89</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100027</th>\n",
       "      <td>85</td>\n",
       "      <td>62</td>\n",
       "      <td>71</td>\n",
       "      <td>78</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100028</th>\n",
       "      <td>99</td>\n",
       "      <td>83</td>\n",
       "      <td>73</td>\n",
       "      <td>79</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100029</th>\n",
       "      <td>57</td>\n",
       "      <td>58</td>\n",
       "      <td>91</td>\n",
       "      <td>75</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100030</th>\n",
       "      <td>69</td>\n",
       "      <td>70</td>\n",
       "      <td>49</td>\n",
       "      <td>91</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100031</th>\n",
       "      <td>93</td>\n",
       "      <td>86</td>\n",
       "      <td>52</td>\n",
       "      <td>82</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100032</th>\n",
       "      <td>29</td>\n",
       "      <td>51</td>\n",
       "      <td>95</td>\n",
       "      <td>80</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100033</th>\n",
       "      <td>52</td>\n",
       "      <td>68</td>\n",
       "      <td>40</td>\n",
       "      <td>86</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100034</th>\n",
       "      <td>90</td>\n",
       "      <td>50</td>\n",
       "      <td>43</td>\n",
       "      <td>85</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100035</th>\n",
       "      <td>70</td>\n",
       "      <td>59</td>\n",
       "      <td>86</td>\n",
       "      <td>82</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100036</th>\n",
       "      <td>98</td>\n",
       "      <td>50</td>\n",
       "      <td>74</td>\n",
       "      <td>95</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100037</th>\n",
       "      <td>96</td>\n",
       "      <td>44</td>\n",
       "      <td>72</td>\n",
       "      <td>79</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100038</th>\n",
       "      <td>56</td>\n",
       "      <td>65</td>\n",
       "      <td>68</td>\n",
       "      <td>82</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100039</th>\n",
       "      <td>88</td>\n",
       "      <td>76</td>\n",
       "      <td>70</td>\n",
       "      <td>73</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100040</th>\n",
       "      <td>104</td>\n",
       "      <td>64</td>\n",
       "      <td>68</td>\n",
       "      <td>81</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "             Chinese  Math  English  Physics\n",
       "32219100001       70    64       79       93\n",
       "32219100002       97    30       55       76\n",
       "32219100003       52    86       45       78\n",
       "32219100004      118    79       78       97\n",
       "32219100005       70    76       83       80\n",
       "32219100006       69    81       70      102\n",
       "32219100007      100   -29       96       78\n",
       "32219100008       94    86       88       93\n",
       "32219100009      129   114      123       63\n",
       "32219100010       75    73       65       81\n",
       "32219100011       77    65       50       64\n",
       "32219100012       50    80       55       88\n",
       "32219100013       73    70       58       67\n",
       "32219100014       65    79       79       82\n",
       "32219100015       71    60       26       77\n",
       "32219100016       45    36       96       68\n",
       "32219100017      113    29       65       63\n",
       "32219100018       51    30       65       74\n",
       "32219100019       23    18       48       97\n",
       "32219100020       56    27       67       77\n",
       "32219100021       67   112       70       89\n",
       "32219100022       57    82       67       79\n",
       "32219100023      101    41       76       88\n",
       "32219100024       77    48       58       61\n",
       "32219100025       80    63       52       75\n",
       "32219100026       92    40       80       89\n",
       "32219100027       85    62       71       78\n",
       "32219100028       99    83       73       79\n",
       "32219100029       57    58       91       75\n",
       "32219100030       69    70       49       91\n",
       "32219100031       93    86       52       82\n",
       "32219100032       29    51       95       80\n",
       "32219100033       52    68       40       86\n",
       "32219100034       90    50       43       85\n",
       "32219100035       70    59       86       82\n",
       "32219100036       98    50       74       95\n",
       "32219100037       96    44       72       79\n",
       "32219100038       56    65       68       82\n",
       "32219100039       88    76       70       73\n",
       "32219100040      104    64       68       81"
      ]
     },
     "execution_count": 65,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 老师给的\n",
    "Chinese=np.random.normal(loc=80, scale=20, size=40).astype(int)\n",
    "Math=np.random.normal(loc=60, scale=30, size=40).astype(int)\n",
    "English=np.random.normal(loc=70, scale=20, size=40).astype(int)\n",
    "Physics=np.random.normal(loc=80, scale=10, size=40).astype(int)\n",
    "\n",
    "studentid=[]\n",
    "for i in range(40):\n",
    "    studentid.append(32219100001+i)\n",
    "\n",
    "score={'Chinese':Chinese,'Math':Math,'English':English,'Physics':Physics}\n",
    "df=pd.DataFrame(score,index=studentid)\n",
    "df"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "17fe5b74-d541-43a9-9714-43d60e860188",
   "metadata": {},
   "source": [
    "# 读取导出文件"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 63,
   "id": "b846315b-ac8d-4eff-a1f6-38e803e90d70",
   "metadata": {},
   "outputs": [],
   "source": [
    "df.to_csv('score.csv')    #导出csv文件 可以用excel打开的"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "c7917902-7f7e-4620-9ba7-8be10c769457",
   "metadata": {},
   "source": [
    "# 选取行数据"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 67,
   "id": "8d5045a2-362f-42f5-b065-e3a2ae600445",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Chinese    104\n",
       "Math        64\n",
       "English     68\n",
       "Physics     81\n",
       "Name: 32219100040, dtype: int32"
      ]
     },
     "execution_count": 67,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 找某个学号\n",
    "df.loc[32219100040]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 77,
   "id": "a9d46e96-b4c2-4cce-9afc-c91afc3a0b4a",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Chinese</th>\n",
       "      <th>Math</th>\n",
       "      <th>English</th>\n",
       "      <th>Physics</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>32219100001</th>\n",
       "      <td>70</td>\n",
       "      <td>64</td>\n",
       "      <td>79</td>\n",
       "      <td>93</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100004</th>\n",
       "      <td>118</td>\n",
       "      <td>79</td>\n",
       "      <td>78</td>\n",
       "      <td>97</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100005</th>\n",
       "      <td>70</td>\n",
       "      <td>76</td>\n",
       "      <td>83</td>\n",
       "      <td>80</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100006</th>\n",
       "      <td>69</td>\n",
       "      <td>81</td>\n",
       "      <td>70</td>\n",
       "      <td>102</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100008</th>\n",
       "      <td>94</td>\n",
       "      <td>86</td>\n",
       "      <td>88</td>\n",
       "      <td>93</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100009</th>\n",
       "      <td>129</td>\n",
       "      <td>114</td>\n",
       "      <td>123</td>\n",
       "      <td>63</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100010</th>\n",
       "      <td>75</td>\n",
       "      <td>73</td>\n",
       "      <td>65</td>\n",
       "      <td>81</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100014</th>\n",
       "      <td>65</td>\n",
       "      <td>79</td>\n",
       "      <td>79</td>\n",
       "      <td>82</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100021</th>\n",
       "      <td>67</td>\n",
       "      <td>112</td>\n",
       "      <td>70</td>\n",
       "      <td>89</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100027</th>\n",
       "      <td>85</td>\n",
       "      <td>62</td>\n",
       "      <td>71</td>\n",
       "      <td>78</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100028</th>\n",
       "      <td>99</td>\n",
       "      <td>83</td>\n",
       "      <td>73</td>\n",
       "      <td>79</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100039</th>\n",
       "      <td>88</td>\n",
       "      <td>76</td>\n",
       "      <td>70</td>\n",
       "      <td>73</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100040</th>\n",
       "      <td>104</td>\n",
       "      <td>64</td>\n",
       "      <td>68</td>\n",
       "      <td>81</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "             Chinese  Math  English  Physics\n",
       "32219100001       70    64       79       93\n",
       "32219100004      118    79       78       97\n",
       "32219100005       70    76       83       80\n",
       "32219100006       69    81       70      102\n",
       "32219100008       94    86       88       93\n",
       "32219100009      129   114      123       63\n",
       "32219100010       75    73       65       81\n",
       "32219100014       65    79       79       82\n",
       "32219100021       67   112       70       89\n",
       "32219100027       85    62       71       78\n",
       "32219100028       99    83       73       79\n",
       "32219100039       88    76       70       73\n",
       "32219100040      104    64       68       81"
      ]
     },
     "execution_count": 77,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 找某科及格的同学\n",
    "df[(df['Chinese']>60)&(df['Math']>60)&(df['English']>60)&(df['Physics']>60)]"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "2f36867a-f4ff-4ad6-9a0b-05967991f986",
   "metadata": {},
   "source": [
    "# 处理统计"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 79,
   "id": "10b9ce32-924f-488b-ac32-f25266545434",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Chinese</th>\n",
       "      <th>Math</th>\n",
       "      <th>English</th>\n",
       "      <th>Physics</th>\n",
       "      <th>total_costs</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>32219100001</th>\n",
       "      <td>70</td>\n",
       "      <td>64</td>\n",
       "      <td>79</td>\n",
       "      <td>93</td>\n",
       "      <td>306</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100002</th>\n",
       "      <td>97</td>\n",
       "      <td>30</td>\n",
       "      <td>55</td>\n",
       "      <td>76</td>\n",
       "      <td>258</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100003</th>\n",
       "      <td>52</td>\n",
       "      <td>86</td>\n",
       "      <td>45</td>\n",
       "      <td>78</td>\n",
       "      <td>261</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100004</th>\n",
       "      <td>118</td>\n",
       "      <td>79</td>\n",
       "      <td>78</td>\n",
       "      <td>97</td>\n",
       "      <td>372</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100005</th>\n",
       "      <td>70</td>\n",
       "      <td>76</td>\n",
       "      <td>83</td>\n",
       "      <td>80</td>\n",
       "      <td>309</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100006</th>\n",
       "      <td>69</td>\n",
       "      <td>81</td>\n",
       "      <td>70</td>\n",
       "      <td>102</td>\n",
       "      <td>322</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100007</th>\n",
       "      <td>100</td>\n",
       "      <td>-29</td>\n",
       "      <td>96</td>\n",
       "      <td>78</td>\n",
       "      <td>245</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100008</th>\n",
       "      <td>94</td>\n",
       "      <td>86</td>\n",
       "      <td>88</td>\n",
       "      <td>93</td>\n",
       "      <td>361</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100009</th>\n",
       "      <td>129</td>\n",
       "      <td>114</td>\n",
       "      <td>123</td>\n",
       "      <td>63</td>\n",
       "      <td>429</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100010</th>\n",
       "      <td>75</td>\n",
       "      <td>73</td>\n",
       "      <td>65</td>\n",
       "      <td>81</td>\n",
       "      <td>294</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100011</th>\n",
       "      <td>77</td>\n",
       "      <td>65</td>\n",
       "      <td>50</td>\n",
       "      <td>64</td>\n",
       "      <td>256</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100012</th>\n",
       "      <td>50</td>\n",
       "      <td>80</td>\n",
       "      <td>55</td>\n",
       "      <td>88</td>\n",
       "      <td>273</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100013</th>\n",
       "      <td>73</td>\n",
       "      <td>70</td>\n",
       "      <td>58</td>\n",
       "      <td>67</td>\n",
       "      <td>268</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100014</th>\n",
       "      <td>65</td>\n",
       "      <td>79</td>\n",
       "      <td>79</td>\n",
       "      <td>82</td>\n",
       "      <td>305</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100015</th>\n",
       "      <td>71</td>\n",
       "      <td>60</td>\n",
       "      <td>26</td>\n",
       "      <td>77</td>\n",
       "      <td>234</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100016</th>\n",
       "      <td>45</td>\n",
       "      <td>36</td>\n",
       "      <td>96</td>\n",
       "      <td>68</td>\n",
       "      <td>245</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100017</th>\n",
       "      <td>113</td>\n",
       "      <td>29</td>\n",
       "      <td>65</td>\n",
       "      <td>63</td>\n",
       "      <td>270</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100018</th>\n",
       "      <td>51</td>\n",
       "      <td>30</td>\n",
       "      <td>65</td>\n",
       "      <td>74</td>\n",
       "      <td>220</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100019</th>\n",
       "      <td>23</td>\n",
       "      <td>18</td>\n",
       "      <td>48</td>\n",
       "      <td>97</td>\n",
       "      <td>186</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100020</th>\n",
       "      <td>56</td>\n",
       "      <td>27</td>\n",
       "      <td>67</td>\n",
       "      <td>77</td>\n",
       "      <td>227</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100021</th>\n",
       "      <td>67</td>\n",
       "      <td>112</td>\n",
       "      <td>70</td>\n",
       "      <td>89</td>\n",
       "      <td>338</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100022</th>\n",
       "      <td>57</td>\n",
       "      <td>82</td>\n",
       "      <td>67</td>\n",
       "      <td>79</td>\n",
       "      <td>285</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100023</th>\n",
       "      <td>101</td>\n",
       "      <td>41</td>\n",
       "      <td>76</td>\n",
       "      <td>88</td>\n",
       "      <td>306</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100024</th>\n",
       "      <td>77</td>\n",
       "      <td>48</td>\n",
       "      <td>58</td>\n",
       "      <td>61</td>\n",
       "      <td>244</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100025</th>\n",
       "      <td>80</td>\n",
       "      <td>63</td>\n",
       "      <td>52</td>\n",
       "      <td>75</td>\n",
       "      <td>270</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100026</th>\n",
       "      <td>92</td>\n",
       "      <td>40</td>\n",
       "      <td>80</td>\n",
       "      <td>89</td>\n",
       "      <td>301</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100027</th>\n",
       "      <td>85</td>\n",
       "      <td>62</td>\n",
       "      <td>71</td>\n",
       "      <td>78</td>\n",
       "      <td>296</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100028</th>\n",
       "      <td>99</td>\n",
       "      <td>83</td>\n",
       "      <td>73</td>\n",
       "      <td>79</td>\n",
       "      <td>334</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100029</th>\n",
       "      <td>57</td>\n",
       "      <td>58</td>\n",
       "      <td>91</td>\n",
       "      <td>75</td>\n",
       "      <td>281</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100030</th>\n",
       "      <td>69</td>\n",
       "      <td>70</td>\n",
       "      <td>49</td>\n",
       "      <td>91</td>\n",
       "      <td>279</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100031</th>\n",
       "      <td>93</td>\n",
       "      <td>86</td>\n",
       "      <td>52</td>\n",
       "      <td>82</td>\n",
       "      <td>313</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100032</th>\n",
       "      <td>29</td>\n",
       "      <td>51</td>\n",
       "      <td>95</td>\n",
       "      <td>80</td>\n",
       "      <td>255</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100033</th>\n",
       "      <td>52</td>\n",
       "      <td>68</td>\n",
       "      <td>40</td>\n",
       "      <td>86</td>\n",
       "      <td>246</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100034</th>\n",
       "      <td>90</td>\n",
       "      <td>50</td>\n",
       "      <td>43</td>\n",
       "      <td>85</td>\n",
       "      <td>268</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100035</th>\n",
       "      <td>70</td>\n",
       "      <td>59</td>\n",
       "      <td>86</td>\n",
       "      <td>82</td>\n",
       "      <td>297</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100036</th>\n",
       "      <td>98</td>\n",
       "      <td>50</td>\n",
       "      <td>74</td>\n",
       "      <td>95</td>\n",
       "      <td>317</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100037</th>\n",
       "      <td>96</td>\n",
       "      <td>44</td>\n",
       "      <td>72</td>\n",
       "      <td>79</td>\n",
       "      <td>291</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100038</th>\n",
       "      <td>56</td>\n",
       "      <td>65</td>\n",
       "      <td>68</td>\n",
       "      <td>82</td>\n",
       "      <td>271</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100039</th>\n",
       "      <td>88</td>\n",
       "      <td>76</td>\n",
       "      <td>70</td>\n",
       "      <td>73</td>\n",
       "      <td>307</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32219100040</th>\n",
       "      <td>104</td>\n",
       "      <td>64</td>\n",
       "      <td>68</td>\n",
       "      <td>81</td>\n",
       "      <td>317</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "             Chinese  Math  English  Physics  total_costs\n",
       "32219100001       70    64       79       93          306\n",
       "32219100002       97    30       55       76          258\n",
       "32219100003       52    86       45       78          261\n",
       "32219100004      118    79       78       97          372\n",
       "32219100005       70    76       83       80          309\n",
       "32219100006       69    81       70      102          322\n",
       "32219100007      100   -29       96       78          245\n",
       "32219100008       94    86       88       93          361\n",
       "32219100009      129   114      123       63          429\n",
       "32219100010       75    73       65       81          294\n",
       "32219100011       77    65       50       64          256\n",
       "32219100012       50    80       55       88          273\n",
       "32219100013       73    70       58       67          268\n",
       "32219100014       65    79       79       82          305\n",
       "32219100015       71    60       26       77          234\n",
       "32219100016       45    36       96       68          245\n",
       "32219100017      113    29       65       63          270\n",
       "32219100018       51    30       65       74          220\n",
       "32219100019       23    18       48       97          186\n",
       "32219100020       56    27       67       77          227\n",
       "32219100021       67   112       70       89          338\n",
       "32219100022       57    82       67       79          285\n",
       "32219100023      101    41       76       88          306\n",
       "32219100024       77    48       58       61          244\n",
       "32219100025       80    63       52       75          270\n",
       "32219100026       92    40       80       89          301\n",
       "32219100027       85    62       71       78          296\n",
       "32219100028       99    83       73       79          334\n",
       "32219100029       57    58       91       75          281\n",
       "32219100030       69    70       49       91          279\n",
       "32219100031       93    86       52       82          313\n",
       "32219100032       29    51       95       80          255\n",
       "32219100033       52    68       40       86          246\n",
       "32219100034       90    50       43       85          268\n",
       "32219100035       70    59       86       82          297\n",
       "32219100036       98    50       74       95          317\n",
       "32219100037       96    44       72       79          291\n",
       "32219100038       56    65       68       82          271\n",
       "32219100039       88    76       70       73          307\n",
       "32219100040      104    64       68       81          317"
      ]
     },
     "execution_count": 79,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df['total_costs'] = df['Chinese'] + df['Math'] + df['English'] + df['Physics']\n",
    "df"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "82415950-6be4-494b-a9b8-e27aa6e3b4dc",
   "metadata": {},
   "source": [
    "#### 作业\n",
    "- 在当前数据的基础上，请进一步完成：\n",
    "1. 计算每个学生的平均。\n",
    "2. 计算每门课的平均\n",
    "3. 按学生的总分排序，输出到CSV，文件名自定\n",
    "4. 请给出一个成绩分析报告：\n",
    "    班上每门课的及格率 ，统计各分数的人数（<60%, 60-80%, 80%以上）"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 103,
   "id": "b805dcfe-2a2d-4288-a7d3-6d69386e4271",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "每门课的平均分:\n",
      "语文成绩    78.275\n",
      "数学成绩    81.900\n",
      "英语成绩    64.950\n",
      "物理成绩    80.575\n",
      "平均分     76.425\n",
      "dtype: float64\n",
      "\n",
      "及格率（百分比）:\n",
      "{'语文成绩': 0.275, '数学成绩': 0.275, '英语成绩': 0.075, '物理成绩': 0.85}\n",
      "\n",
      "各分数段的人数统计:\n",
      "          语文成绩  数学成绩  英语成绩  物理成绩  平均分  总分\n",
      "语文成绩                                     \n",
      "0%-60%      29    29    37     7    3   0\n",
      "60%-80%      9     5     3    15   25   0\n",
      "80%-100%     2     4     0    10   10   0\n"
     ]
    }
   ],
   "source": [
    "import numpy as np\n",
    "import pandas as pd\n",
    "\n",
    "student_ids = np.arange(32219100001, 32219100041)\n",
    "chinese = np.random.normal(80,20,40).astype(np.int32)\n",
    "maths = np.random.normal(80,30,40).astype(np.int32)\n",
    "English = np.random.normal(70,20,40).astype(np.int32)\n",
    "physics = np.random.normal(80,20,40).astype(np.int32)\n",
    "\n",
    "df = pd.DataFrame({'语文成绩': chinese, '数学成绩': maths,'英语成绩':English, '物理成绩': physics},index = student_ids)\n",
    "\n",
    "#每个学生的平均分\n",
    "df['平均分'] = df.mean(axis=1)\n",
    "\n",
    "#每门课的平均分\n",
    "subject_means = df.mean()\n",
    "\n",
    "#学生总分\n",
    "df['总分'] = df['语文成绩'] + df['数学成绩'] + df['英语成绩'] + df['物理成绩']\n",
    "\n",
    "#排序\n",
    "df_sorted = df.sort_values(by='总分', ascending=False)\n",
    "\n",
    "# 输出\n",
    "df_sorted.to_csv('score-homework.csv')\n",
    "\n",
    "#成绩分析\n",
    "#1、及格率\n",
    "pass_standards = {'语文成绩': 90,'数学成绩': 90,'英语成绩': 90,'物理成绩': 60}\n",
    "pass_rates = {subject: (df[subject] >= standard).mean() for subject, standard in pass_standards.items()}\n",
    "\n",
    "#2、各分数段的人数\n",
    "bins_chinese_maths_English = [0, 90, 120, 150]\n",
    "labels_chinese_maths_English = ['0%-60%', '60%-80%', '80%-100%']\n",
    "bins_physics = [0, 60, 80, 100]\n",
    "labels_physics = ['0%-60%', '60%-80%', '80%-100%']\n",
    "\n",
    "score_distribution = pd.DataFrame()\n",
    "for subject in df.columns:\n",
    "    if subject in ['语文成绩', '数学成绩', '英语成绩']:\n",
    "        distribution = pd.cut(df[subject], bins=bins_chinese_maths_English, labels=labels_chinese_maths_English, include_lowest=True).value_counts().sort_index()\n",
    "    else:\n",
    "        distribution = pd.cut(df[subject], bins=bins_physics, labels=labels_physics, include_lowest=True).value_counts().sort_index()\n",
    "    score_distribution[subject] = distribution\n",
    "\n",
    "#3、输出报告\n",
    "print(\"每门课的平均分:\")\n",
    "print(subject_means)\n",
    "print(\"\\n及格率（百分比）:\")\n",
    "print(pass_rates)\n",
    "print(\"\\n各分数段的人数统计:\")\n",
    "print(score_distribution)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "2c613c5a-64b9-4789-b7d6-886c81da9491",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "d31d87e4-d2bc-4383-b8e1-d04db65da86f",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.12.4"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
